package com.example.sunsg.okhttptest.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by sunsg on 16/3/2.
 */
public class LocalImageItemImage implements LocalImageItem.LocalImageChildItem, Parcelable {
    /**图片在左边*/
    public static final int INDEX_LEFT = 0;
    /**图片在中间*/
    public static final int INDEX_MIDDLE = 1;
    /**图片在右边*/
    public static final int INDEX_RIGHT = 2;
    private Image image;
    /**在每一行 的第几个 从 0 开始*/
    private int index;
    /**是否被选中*/
    private boolean isChecked;

    public LocalImageItemImage() {
    }

    public LocalImageItemImage(Image image,int index) {
        this.image = image;
        this.index = index;
    }

    public Image getImage() {
        return image;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(this.image, 0);
        dest.writeInt(this.index);
        dest.writeByte(isChecked ? (byte) 1 : (byte) 0);
    }

    protected LocalImageItemImage(Parcel in) {
        this.image = in.readParcelable(Image.class.getClassLoader());
        this.index = in.readInt();
        this.isChecked = in.readByte() != 0;
    }

    public static final Creator<LocalImageItemImage> CREATOR = new Creator<LocalImageItemImage>() {
        public LocalImageItemImage createFromParcel(Parcel source) {
            return new LocalImageItemImage(source);
        }

        public LocalImageItemImage[] newArray(int size) {
            return new LocalImageItemImage[size];
        }
    };
}
